﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.GameComponents;
using TaleWorlds.Core;
using TaleWorlds.Localization;  
using TaleWorlds.MountAndBlade;
using TaleWorlds.Library;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.ScreenSystem;

//mode注册
//目前是还能用的mod,对应游戏版本v1.0.3.9860

namespace ExampleMod
{
    public class MySubModule:MBSubModuleBase
    {
        protected override void OnSubModuleLoad()
        {
            //示例功能,在菜单选项中添加一个菜单,用来看看mod加载成功了么
            Module.CurrentModule.AddInitialStateOption(new InitialStateOption("Message",
            new TextObject("我就问你牛不牛逼", null),
            9990,
            () => { InformationManager.DisplayMessage(new InformationMessage("真,牛逼666!")); },
            () => { return (false, TextObject.Empty); }));
            
            
        }
        protected override void OnGameStart(Game game, IGameStarter gameStarterObject)
        {
            // 目前，MBSubModule.OnGameStart() 是一个空进程，但以防万一。
            base.OnGameStart(game, gameStarterObject);

            // 您可以选择行为适用的 GameType。
            // 战役：一般战役（包括故事模式）
            // CampaignStoryMode：仅故事模式
            // CustomGame：自定义战斗？
            // EditorGame: 也许是通过《霸主》改装套件推出的游戏
            // 多人游戏：多
            if (game.GameType is Campaign)
            {
                CampaignGameStarter campaignGameStarter = (CampaignGameStarter)gameStarterObject;
                
                //自定义技能点数,每升1级给10点
                campaignGameStarter.AddModel(new CustomCharacterDevelopmentModel());
                //改变部队中俘虏的上限,城堡的没变
                campaignGameStarter.AddModel(new CustomPartySizeLimitModel());
                //自定义玩家移动速度
                campaignGameStarter.AddModel(new CustomPartySpeedCalculatingModel());
                //日进斗金,同时加经验
                campaignGameStarter.AddBehavior(new DailyIncomeBehavior());
                //添加一个升级的监控事件.防止专精点溢出
                campaignGameStarter.AddBehavior(new LevelUP());


            }
        }

        //打开设置菜单
        public static void OpenConfigurationScreen()
        {
            if (!MySubModule._configurationSettingsIsOpen)
            {
                MySubModule._configMenu = new ADConfigMenuGauntletScreen();
                ScreenManager.PushScreen(MySubModule._configMenu);
                MySubModule._configurationSettingsIsOpen = true;
            }
        }

        //设置菜单是否打开
        public static bool _configurationSettingsIsOpen;

        // Token: 0x040001BF RID: 447
        private static ADConfigMenuGauntletScreen _configMenu;


    }

 





    
}
